﻿using Red.Controls.Shell;
using Red.EngineData.View;
using System;
using System.ComponentModel.Composition;
using System.Windows;

namespace Red.Toolkit.MaterialEditor
{
    /// <summary>
    ///     This is how we make the editor a plug-in
    /// </summary>
    [Export( typeof( IEditorInfo ) )]
    public class EditorInfo : IEditorInfo
    {
        public string Name
        {
            get { return "Material template editor"; }
        }

        public Type WindowClass
        {
            get { return typeof( MaterialEditor ); }
        }

        public Type SettingsClass
        {
            get { return typeof( MaterialEditorSettings ); }
        }
    }
    
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MaterialEditor : RedEditorWindow
    {
        public MaterialEditor(IEditorHost host, EditorInstanceData instanceData, EditorSharedData sharedData)
            : base( host, instanceData, sharedData )
        {
            InitializeComponent();
        }

        private async void RecompileBtn_Click(object sender, RoutedEventArgs e)
        {
            await InstanceData.RootEditorItem.ExecuteAsync( "compile");
        }
    }
}
